{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 2
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython2",
      "version": "2.7.6"
    },
    "colab": {
      "name": "benchmark_caching_performance.ipynb",
      "provenance": [],
      "include_colab_link": true
    },
    "accelerator": "GPU",
    "widgets": {
      "application/vnd.jupyter.widget-state+json": {
        "50ccca0c5b694c1b98de445ba5c3d67c": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "state": {
            "_view_name": "HBoxView",
            "_dom_classes": [],
            "_model_name": "HBoxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "box_style": "",
            "layout": "IPY_MODEL_4e4012996bc94d3d8c712ccb354fd8b5",
            "_model_module": "@jupyter-widgets/controls",
            "children": [
              "IPY_MODEL_f06356651b4c4cd7bfe6688ee2b23a1c",
              "IPY_MODEL_6bb88890db9d414580d3194ef87b3d8c"
            ]
          }
        },
        "4e4012996bc94d3d8c712ccb354fd8b5": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "f06356651b4c4cd7bfe6688ee2b23a1c": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "state": {
            "_view_name": "ProgressView",
            "style": "IPY_MODEL_f494885dff324f868f48d6e57510d898",
            "_dom_classes": [],
            "description": "Dl Completed...: 100%",
            "_model_name": "FloatProgressModel",
            "bar_style": "success",
            "max": 1,
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": 1,
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "orientation": "horizontal",
            "min": 0,
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_464dc04146694d95a2fa615ec1f3cc34"
          }
        },
        "6bb88890db9d414580d3194ef87b3d8c": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "state": {
            "_view_name": "HTMLView",
            "style": "IPY_MODEL_87523e9d7bcf40fca7dcf1bff7655a5d",
            "_dom_classes": [],
            "description": "",
            "_model_name": "HTMLModel",
            "placeholder": "​",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": " 1/1 [00:06&lt;00:00,  6.29s/ url]",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_b7e58fe5dd5f4ca59bdae42dbab34e8e"
          }
        },
        "f494885dff324f868f48d6e57510d898": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "ProgressStyleModel",
            "description_width": "initial",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "bar_color": null,
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "464dc04146694d95a2fa615ec1f3cc34": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "87523e9d7bcf40fca7dcf1bff7655a5d": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "b7e58fe5dd5f4ca59bdae42dbab34e8e": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "52dde642a26844dabbc14e7e93adb87f": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "state": {
            "_view_name": "HBoxView",
            "_dom_classes": [],
            "_model_name": "HBoxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "box_style": "",
            "layout": "IPY_MODEL_2ba1bfc353a84385ac832bbd8e023198",
            "_model_module": "@jupyter-widgets/controls",
            "children": [
              "IPY_MODEL_ee1652121c024ce9a341eae98db573c7",
              "IPY_MODEL_a900ade188d2434a82b659fc546c4691"
            ]
          }
        },
        "2ba1bfc353a84385ac832bbd8e023198": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "ee1652121c024ce9a341eae98db573c7": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "state": {
            "_view_name": "ProgressView",
            "style": "IPY_MODEL_a87fe187bd4d4cdcb13b51b7df3e96a2",
            "_dom_classes": [],
            "description": "Dl Size...: 100%",
            "_model_name": "FloatProgressModel",
            "bar_style": "success",
            "max": 1,
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": 1,
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "orientation": "horizontal",
            "min": 0,
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_c6b753097c1a434cac7668bb1b5e8c07"
          }
        },
        "a900ade188d2434a82b659fc546c4691": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "state": {
            "_view_name": "HTMLView",
            "style": "IPY_MODEL_4771d5be7bbd4701b68fb1dc34f4fd91",
            "_dom_classes": [],
            "description": "",
            "_model_name": "HTMLModel",
            "placeholder": "​",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": " 162/162 [00:06&lt;00:00, 25.89 MiB/s]",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_15d72911263d4ee88926fa7983c5eba4"
          }
        },
        "a87fe187bd4d4cdcb13b51b7df3e96a2": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "ProgressStyleModel",
            "description_width": "initial",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "bar_color": null,
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "c6b753097c1a434cac7668bb1b5e8c07": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "4771d5be7bbd4701b68fb1dc34f4fd91": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "15d72911263d4ee88926fa7983c5eba4": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "b1956b7aeb524552afba21638992f6cd": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "state": {
            "_view_name": "HBoxView",
            "_dom_classes": [],
            "_model_name": "HBoxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "box_style": "",
            "layout": "IPY_MODEL_b373c87418544e57af99df33d992de7b",
            "_model_module": "@jupyter-widgets/controls",
            "children": [
              "IPY_MODEL_ca05f9b0ae1a4b079bed157516622846",
              "IPY_MODEL_3ca20897e5da4968ab84382dc1b61aa6"
            ]
          }
        },
        "b373c87418544e57af99df33d992de7b": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "ca05f9b0ae1a4b079bed157516622846": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "state": {
            "_view_name": "ProgressView",
            "style": "IPY_MODEL_cf082a21e4cc4db7b4e82b54440c432e",
            "_dom_classes": [],
            "description": "Extraction completed...: 100%",
            "_model_name": "FloatProgressModel",
            "bar_style": "success",
            "max": 1,
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": 1,
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "orientation": "horizontal",
            "min": 0,
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_520b2ba250954943a3717ea44f759e1d"
          }
        },
        "3ca20897e5da4968ab84382dc1b61aa6": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "state": {
            "_view_name": "HTMLView",
            "style": "IPY_MODEL_5f683aeb66f94fbea0a03d19414cdb90",
            "_dom_classes": [],
            "description": "",
            "_model_name": "HTMLModel",
            "placeholder": "​",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": " 1/1 [00:06&lt;00:00,  6.21s/ file]",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_613e0d7ac47d4a45baa9cc8f53219f8d"
          }
        },
        "cf082a21e4cc4db7b4e82b54440c432e": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "ProgressStyleModel",
            "description_width": "initial",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "bar_color": null,
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "520b2ba250954943a3717ea44f759e1d": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "5f683aeb66f94fbea0a03d19414cdb90": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "613e0d7ac47d4a45baa9cc8f53219f8d": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "1825b1eac66c43b780672d6945eaa77a": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "state": {
            "_view_name": "HBoxView",
            "_dom_classes": [],
            "_model_name": "HBoxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "box_style": "",
            "layout": "IPY_MODEL_f96542dcc5374c4d897723cf426c6881",
            "_model_module": "@jupyter-widgets/controls",
            "children": [
              "IPY_MODEL_06e4ec80135a49a6a261daf755a3de7b",
              "IPY_MODEL_9538ee300771419ca69fb82d3ab75eca"
            ]
          }
        },
        "f96542dcc5374c4d897723cf426c6881": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "06e4ec80135a49a6a261daf755a3de7b": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "state": {
            "_view_name": "ProgressView",
            "style": "IPY_MODEL_d9aa80cc707e4ebc9916330fe447f5d5",
            "_dom_classes": [],
            "description": "",
            "_model_name": "FloatProgressModel",
            "bar_style": "info",
            "max": 1,
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": 1,
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "orientation": "horizontal",
            "min": 0,
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_68a48e8a1c154946a3333513322fa6b9"
          }
        },
        "9538ee300771419ca69fb82d3ab75eca": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "state": {
            "_view_name": "HTMLView",
            "style": "IPY_MODEL_9834e71988e649bc8db9ef45a3e8c87f",
            "_dom_classes": [],
            "description": "",
            "_model_name": "HTMLModel",
            "placeholder": "​",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": " 50000/0 [00:50&lt;00:00, 1181.81 examples/s]",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_86955fc7ab864369b6f83c871d0b858c"
          }
        },
        "d9aa80cc707e4ebc9916330fe447f5d5": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "ProgressStyleModel",
            "description_width": "initial",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "bar_color": null,
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "68a48e8a1c154946a3333513322fa6b9": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "9834e71988e649bc8db9ef45a3e8c87f": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "86955fc7ab864369b6f83c871d0b858c": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "ac2240911b714238a353fa50743675cb": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "state": {
            "_view_name": "HBoxView",
            "_dom_classes": [],
            "_model_name": "HBoxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "box_style": "",
            "layout": "IPY_MODEL_d811703e08394bc88016127406112aae",
            "_model_module": "@jupyter-widgets/controls",
            "children": [
              "IPY_MODEL_a14da34333ae43b0a471f8601912c43e",
              "IPY_MODEL_1539fc224f804cd6b489fe61f5cf8fc1"
            ]
          }
        },
        "d811703e08394bc88016127406112aae": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "a14da34333ae43b0a471f8601912c43e": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "state": {
            "_view_name": "ProgressView",
            "style": "IPY_MODEL_672682a96cc74aac8485ba7167f8d8a8",
            "_dom_classes": [],
            "description": " 96%",
            "_model_name": "FloatProgressModel",
            "bar_style": "danger",
            "max": 50000,
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": 48185,
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "orientation": "horizontal",
            "min": 0,
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_39763f15735b4f378eeb9107adbd7795"
          }
        },
        "1539fc224f804cd6b489fe61f5cf8fc1": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "state": {
            "_view_name": "HTMLView",
            "style": "IPY_MODEL_cfc923bf2fb0431b8f10ebd90b693ec7",
            "_dom_classes": [],
            "description": "",
            "_model_name": "HTMLModel",
            "placeholder": "​",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": " 48185/50000 [00:00&lt;01:05, 27.85 examples/s]",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_a295141aa5db4799bfb111a15839ac39"
          }
        },
        "672682a96cc74aac8485ba7167f8d8a8": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "ProgressStyleModel",
            "description_width": "initial",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "bar_color": null,
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "39763f15735b4f378eeb9107adbd7795": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "cfc923bf2fb0431b8f10ebd90b693ec7": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "a295141aa5db4799bfb111a15839ac39": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "6124b8c78cd54a839c746ea781389f77": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "state": {
            "_view_name": "HBoxView",
            "_dom_classes": [],
            "_model_name": "HBoxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "box_style": "",
            "layout": "IPY_MODEL_dcb5bbd86fa44b36adb72f32eda9a24b",
            "_model_module": "@jupyter-widgets/controls",
            "children": [
              "IPY_MODEL_f682146863b64943abfc78c17d6dae3c",
              "IPY_MODEL_428f841ffad34122a62031cd2610c9b7"
            ]
          }
        },
        "dcb5bbd86fa44b36adb72f32eda9a24b": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "f682146863b64943abfc78c17d6dae3c": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "state": {
            "_view_name": "ProgressView",
            "style": "IPY_MODEL_982d413ca17a4bdb95a79e8cc65f2475",
            "_dom_classes": [],
            "description": "",
            "_model_name": "FloatProgressModel",
            "bar_style": "info",
            "max": 1,
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": 1,
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "orientation": "horizontal",
            "min": 0,
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_b528367b7512427cb05dd60596eb7cc0"
          }
        },
        "428f841ffad34122a62031cd2610c9b7": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "state": {
            "_view_name": "HTMLView",
            "style": "IPY_MODEL_3276adcf0e864b209ca2c71bbc925891",
            "_dom_classes": [],
            "description": "",
            "_model_name": "HTMLModel",
            "placeholder": "​",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": " 10000/0 [00:08&lt;00:00, 1196.88 examples/s]",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_574ee7a6159f41baa2a38da03c4317c0"
          }
        },
        "982d413ca17a4bdb95a79e8cc65f2475": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "ProgressStyleModel",
            "description_width": "initial",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "bar_color": null,
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "b528367b7512427cb05dd60596eb7cc0": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "3276adcf0e864b209ca2c71bbc925891": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "574ee7a6159f41baa2a38da03c4317c0": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "bea43d291e0848039e811024bd7e5eea": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "state": {
            "_view_name": "HBoxView",
            "_dom_classes": [],
            "_model_name": "HBoxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "box_style": "",
            "layout": "IPY_MODEL_6dd5311b7fd64491848ec5735ef2bd8a",
            "_model_module": "@jupyter-widgets/controls",
            "children": [
              "IPY_MODEL_b8c47d463df949d6abd8b94b522d183b",
              "IPY_MODEL_385bcc3cc25a49a1a90ed7bd02e1ca86"
            ]
          }
        },
        "6dd5311b7fd64491848ec5735ef2bd8a": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "b8c47d463df949d6abd8b94b522d183b": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "state": {
            "_view_name": "ProgressView",
            "style": "IPY_MODEL_095836e395f546c1ac780210f4b83900",
            "_dom_classes": [],
            "description": " 88%",
            "_model_name": "FloatProgressModel",
            "bar_style": "danger",
            "max": 10000,
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": 8784,
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "orientation": "horizontal",
            "min": 0,
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_905dd8e22ac84291b7a5b87ee9fb9935"
          }
        },
        "385bcc3cc25a49a1a90ed7bd02e1ca86": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "state": {
            "_view_name": "HTMLView",
            "style": "IPY_MODEL_5161a1060c9244b2add7966575470874",
            "_dom_classes": [],
            "description": "",
            "_model_name": "HTMLModel",
            "placeholder": "​",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": " 8784/10000 [00:00&lt;00:00, 87835.69 examples/s]",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_4e6a6f59aaba45c4badae1ba9009b79f"
          }
        },
        "095836e395f546c1ac780210f4b83900": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "ProgressStyleModel",
            "description_width": "initial",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "bar_color": null,
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "905dd8e22ac84291b7a5b87ee9fb9935": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "5161a1060c9244b2add7966575470874": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "4e6a6f59aaba45c4badae1ba9009b79f": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        }
      }
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/few-shot-learning/Keras-FewShotLearning/blob/notebooks%2Fbenchmark-perf-caches/notebooks/benchmark_caching_performance.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "7gQubOH80hKo",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "outputId": "e6088067-cd34-4a9a-a4cb-bac93ecd82c2"
      },
      "source": [
        "! git clone https://github.com/few-shot-learning/Keras-FewShotLearning.git\n",
        "%cd Keras-FewShotLearning\n",
        "! curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python\n",
        "! $HOME/.poetry/bin/poetry config virtualenvs.create false --local\n",
        "! $HOME/.poetry/bin/poetry add protobuf==3.10.0  # Fix for colab version\n",
        "! $HOME/.poetry/bin/poetry add gpumonitor  # Fix for colab version"
      ],
      "execution_count": 1,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Cloning into 'Keras-FewShotLearning'...\n",
            "remote: Enumerating objects: 103, done.\u001b[K\n",
            "remote: Counting objects: 100% (103/103), done.\u001b[K\n",
            "remote: Compressing objects: 100% (80/80), done.\u001b[K\n",
            "remote: Total 1635 (delta 44), reused 43 (delta 19), pack-reused 1532\u001b[K\n",
            "Receiving objects: 100% (1635/1635), 1.96 MiB | 11.66 MiB/s, done.\n",
            "Resolving deltas: 100% (948/948), done.\n",
            "/content/Keras-FewShotLearning\n",
            "\u001b[32mRetrieving Poetry metadata\u001b[0m\n",
            "\n",
            "# Welcome to \u001b[32mPoetry\u001b[0m!\n",
            "\n",
            "This will download and install the latest version of \u001b[32mPoetry\u001b[0m,\n",
            "a dependency and package manager for Python.\n",
            "\n",
            "It will add the `poetry` command to \u001b[32mPoetry\u001b[0m's bin directory, located at:\n",
            "\n",
            "\u001b[33m$HOME/.poetry/bin\u001b[0m\n",
            "\n",
            "This path will then be added to your `PATH` environment variable by\n",
            "modifying the profile file located at:\n",
            "\n",
            "\u001b[33m$HOME/.profile\u001b[0m\n",
            "\n",
            "You can uninstall at any time by executing this script with the --uninstall option,\n",
            "and these changes will be reverted.\n",
            "\n",
            "Installing version: \u001b[32m1.0.9\u001b[0m\n",
            "  - Downloading \u001b[33mpoetry-1.0.9-linux.tar.gz\u001b[0m (25.37MB)\n",
            "\n",
            "\u001b[32mPoetry\u001b[0m (\u001b[33m1.0.9\u001b[0m) is installed now. Great!\n",
            "\n",
            "To get started you need \u001b[32mPoetry\u001b[0m's bin directory (\u001b[33m$HOME/.poetry/bin\u001b[0m) in your `PATH`\n",
            "environment variable. Next time you log in this will be done\n",
            "automatically.\n",
            "\n",
            "To configure your current shell run `source \u001b[33m$HOME/.poetry/env\u001b[0m`\n",
            "\n",
            "\u001b[30;43mSkipping virtualenv creation, as specified in config file.\u001b[0m\n",
            "\n",
            "\u001b[34mUpdating dependencies\u001b[0m\n",
            "\u001b[2K\u001b[34mResolving dependencies...\u001b[0m \u001b[30;1m(15.5s)\u001b[0m\n",
            "\n",
            "\u001b[34mWriting lock file\u001b[0m\n",
            "\n",
            "\n",
            "Package operations: \u001b[34m10\u001b[0m installs, \u001b[34m21\u001b[0m updates, \u001b[34m0\u001b[0m removals\n",
            "\n",
            "  - Updating \u001b[36murllib3\u001b[0m (\u001b[1m1.24.3\u001b[0m -> \u001b[1m1.25.9\u001b[0m)\n",
            "  - Updating \u001b[36mrsa\u001b[0m (\u001b[1m4.6\u001b[0m -> \u001b[1m4.1\u001b[0m)\n",
            "  - Updating \u001b[36msix\u001b[0m (\u001b[1m1.12.0\u001b[0m -> \u001b[1m1.15.0\u001b[0m)\n",
            "  - Updating \u001b[36mgoogle-auth\u001b[0m (\u001b[1m1.17.2\u001b[0m -> \u001b[1m1.17.0\u001b[0m)\n",
            "  - Updating \u001b[36mpillow\u001b[0m (\u001b[1m7.0.0\u001b[0m -> \u001b[1m7.1.2\u001b[0m)\n",
            "  - Updating \u001b[36mimageio\u001b[0m (\u001b[1m2.4.1\u001b[0m -> \u001b[1m2.8.0\u001b[0m)\n",
            "  - Updating \u001b[36mmore-itertools\u001b[0m (\u001b[1m8.4.0\u001b[0m -> \u001b[1m8.3.0\u001b[0m)\n",
            "  - Updating \u001b[36mpluggy\u001b[0m (\u001b[1m0.7.1\u001b[0m -> \u001b[1m0.13.1\u001b[0m)\n",
            "  - Updating \u001b[36mpytz\u001b[0m (\u001b[1m2018.9\u001b[0m -> \u001b[1m2020.1\u001b[0m)\n",
            "  - Installing \u001b[36mappdirs\u001b[0m (\u001b[1m1.4.4\u001b[0m)\n",
            "  - Updating \u001b[36mcoverage\u001b[0m (\u001b[1m3.7.1\u001b[0m -> \u001b[1m5.1\u001b[0m)\n",
            "  - Updating \u001b[36mfuture\u001b[0m (\u001b[1m0.16.0\u001b[0m -> \u001b[1m0.18.2\u001b[0m)\n",
            "  - Installing \u001b[36mmccabe\u001b[0m (\u001b[1m0.6.1\u001b[0m)\n",
            "  - Updating \u001b[36mopencv-python\u001b[0m (\u001b[1m4.1.2.30\u001b[0m -> \u001b[1m4.2.0.34\u001b[0m)\n",
            "  - Installing \u001b[36mpathspec\u001b[0m (\u001b[1m0.8.0\u001b[0m)\n",
            "  - Installing \u001b[36mpycodestyle\u001b[0m (\u001b[1m2.6.0\u001b[0m)\n",
            "  - Installing \u001b[36mpyflakes\u001b[0m (\u001b[1m2.2.0\u001b[0m)\n",
            "  - Updating \u001b[36mpytest\u001b[0m (\u001b[1m3.6.4\u001b[0m -> \u001b[1m5.4.3\u001b[0m)\n",
            "  - Updating \u001b[36mregex\u001b[0m (\u001b[1m2019.12.20\u001b[0m -> \u001b[1m2020.6.8\u001b[0m)\n",
            "  - Updating \u001b[36mscikit-image\u001b[0m (\u001b[1m0.16.2\u001b[0m -> \u001b[1m0.17.2\u001b[0m)\n",
            "  - Installing \u001b[36mtoml\u001b[0m (\u001b[1m0.10.1\u001b[0m)\n",
            "  - Updating \u001b[36mtqdm\u001b[0m (\u001b[1m4.41.1\u001b[0m -> \u001b[1m4.46.1\u001b[0m)\n",
            "  - Installing \u001b[36mtyped-ast\u001b[0m (\u001b[1m1.4.1\u001b[0m)\n",
            "  - Updating \u001b[36mtypeguard\u001b[0m (\u001b[1m2.7.1\u001b[0m -> \u001b[1m2.9.1\u001b[0m)\n",
            "  - Installing \u001b[36mblack\u001b[0m (\u001b[1m19.10b0\u001b[0m)\n",
            "  - Installing \u001b[36mflake8\u001b[0m (\u001b[1m3.8.3\u001b[0m)\n",
            "  - Updating \u001b[36mimgaug\u001b[0m (\u001b[1m0.2.9\u001b[0m -> \u001b[1m0.4.0\u001b[0m)\n",
            "  - Installing \u001b[36mpytest-cov\u001b[0m (\u001b[1m2.9.0\u001b[0m)\n",
            "  - Updating \u001b[36mpyyaml\u001b[0m (\u001b[1m3.13\u001b[0m -> \u001b[1m5.3.1\u001b[0m)\n",
            "  - Updating \u001b[36mtensorflow-addons\u001b[0m (\u001b[1m0.8.3\u001b[0m -> \u001b[1m0.9.1\u001b[0m)\n",
            "  - Updating \u001b[36mtensorflow-datasets\u001b[0m (\u001b[1m2.1.0\u001b[0m -> \u001b[1m3.1.0\u001b[0m)\n",
            "\u001b[30;43mSkipping virtualenv creation, as specified in config file.\u001b[0m\n",
            "Using version \u001b[1m^0.1.2\u001b[0m for \u001b[36mgpumonitor\u001b[0m\n",
            "\n",
            "\u001b[34mUpdating dependencies\u001b[0m\n",
            "\u001b[2K\u001b[34mResolving dependencies...\u001b[0m \u001b[30;1m(1.4s)\u001b[0m\n",
            "\n",
            "\u001b[34mWriting lock file\u001b[0m\n",
            "\n",
            "\n",
            "Package operations: \u001b[34m3\u001b[0m installs, \u001b[34m1\u001b[0m update, \u001b[34m0\u001b[0m removals\n",
            "\n",
            "  - Installing \u001b[36mblessings\u001b[0m (\u001b[1m1.7\u001b[0m)\n",
            "  - Updating \u001b[36mpsutil\u001b[0m (\u001b[1m5.4.8\u001b[0m -> \u001b[1m5.7.0\u001b[0m)\n",
            "  - Installing \u001b[36mgpustat\u001b[0m (\u001b[1m0.6.0\u001b[0m)\n",
            "  - Installing \u001b[36mgpumonitor\u001b[0m (\u001b[1m0.1.2\u001b[0m)\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "pycharm": {
          "name": "#%% Imports\n"
        },
        "id": "8N3mJaLAto5d",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "from pathlib import Path\n",
        "\n",
        "import pandas as pd\n",
        "import tensorflow as tf\n",
        "import tensorflow_datasets as tfds\n",
        "from functools import partial\n",
        "from gpumonitor.callbacks.tf import TFGpuMonitorCallback\n",
        "from tensorflow.keras.layers import Conv2D, Dropout, Flatten, GlobalMaxPooling2D, Input, MaxPooling2D\n",
        "from tensorflow.keras.models import Sequential\n",
        "\n",
        "from keras_fsl.utils.datasets import assign, cache, cache_with_tf_record, read_decode_and_crop_jpeg, transform"
      ],
      "execution_count": 2,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "pycharm": {
          "name": "#%% Read Cifar10 dataset to dump images and create df\n"
        },
        "id": "5mLM_qtdto5h",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 410,
          "referenced_widgets": [
            "50ccca0c5b694c1b98de445ba5c3d67c",
            "4e4012996bc94d3d8c712ccb354fd8b5",
            "f06356651b4c4cd7bfe6688ee2b23a1c",
            "6bb88890db9d414580d3194ef87b3d8c",
            "f494885dff324f868f48d6e57510d898",
            "464dc04146694d95a2fa615ec1f3cc34",
            "87523e9d7bcf40fca7dcf1bff7655a5d",
            "b7e58fe5dd5f4ca59bdae42dbab34e8e",
            "52dde642a26844dabbc14e7e93adb87f",
            "2ba1bfc353a84385ac832bbd8e023198",
            "ee1652121c024ce9a341eae98db573c7",
            "a900ade188d2434a82b659fc546c4691",
            "a87fe187bd4d4cdcb13b51b7df3e96a2",
            "c6b753097c1a434cac7668bb1b5e8c07",
            "4771d5be7bbd4701b68fb1dc34f4fd91",
            "15d72911263d4ee88926fa7983c5eba4",
            "b1956b7aeb524552afba21638992f6cd",
            "b373c87418544e57af99df33d992de7b",
            "ca05f9b0ae1a4b079bed157516622846",
            "3ca20897e5da4968ab84382dc1b61aa6",
            "cf082a21e4cc4db7b4e82b54440c432e",
            "520b2ba250954943a3717ea44f759e1d",
            "5f683aeb66f94fbea0a03d19414cdb90",
            "613e0d7ac47d4a45baa9cc8f53219f8d",
            "1825b1eac66c43b780672d6945eaa77a",
            "f96542dcc5374c4d897723cf426c6881",
            "06e4ec80135a49a6a261daf755a3de7b",
            "9538ee300771419ca69fb82d3ab75eca",
            "d9aa80cc707e4ebc9916330fe447f5d5",
            "68a48e8a1c154946a3333513322fa6b9",
            "9834e71988e649bc8db9ef45a3e8c87f",
            "86955fc7ab864369b6f83c871d0b858c",
            "ac2240911b714238a353fa50743675cb",
            "d811703e08394bc88016127406112aae",
            "a14da34333ae43b0a471f8601912c43e",
            "1539fc224f804cd6b489fe61f5cf8fc1",
            "672682a96cc74aac8485ba7167f8d8a8",
            "39763f15735b4f378eeb9107adbd7795",
            "cfc923bf2fb0431b8f10ebd90b693ec7",
            "a295141aa5db4799bfb111a15839ac39",
            "6124b8c78cd54a839c746ea781389f77",
            "dcb5bbd86fa44b36adb72f32eda9a24b",
            "f682146863b64943abfc78c17d6dae3c",
            "428f841ffad34122a62031cd2610c9b7",
            "982d413ca17a4bdb95a79e8cc65f2475",
            "b528367b7512427cb05dd60596eb7cc0",
            "3276adcf0e864b209ca2c71bbc925891",
            "574ee7a6159f41baa2a38da03c4317c0",
            "bea43d291e0848039e811024bd7e5eea",
            "6dd5311b7fd64491848ec5735ef2bd8a",
            "b8c47d463df949d6abd8b94b522d183b",
            "385bcc3cc25a49a1a90ed7bd02e1ca86",
            "095836e395f546c1ac780210f4b83900",
            "905dd8e22ac84291b7a5b87ee9fb9935",
            "5161a1060c9244b2add7966575470874",
            "4e6a6f59aaba45c4badae1ba9009b79f"
          ]
        },
        "outputId": "b1f4e593-2bb5-4ce5-9375-bc547036fa47"
      },
      "source": [
        "train_dataset = tfds.load(name=\"cifar10\", split=\"train\")\n",
        "output_dir = Path(\"logs\") / \"benchmark_caching_performance\"\n",
        "(output_dir / \"cifar10\").mkdir(exist_ok=True, parents=True)\n",
        "examples = []\n",
        "for example in train_dataset:\n",
        "    tf.io.write_file(str(output_dir / \"cifar10\" / example[\"id\"].numpy().decode()), tf.io.encode_jpeg(example[\"image\"]))\n",
        "    examples += [{\"id\": example[\"id\"].numpy().decode(), \"label\": example[\"label\"].numpy()}]"
      ],
      "execution_count": 3,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "\u001b[1mDownloading and preparing dataset cifar10/3.0.2 (download: 162.17 MiB, generated: 132.40 MiB, total: 294.58 MiB) to /root/tensorflow_datasets/cifar10/3.0.2...\u001b[0m\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "display_data",
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "50ccca0c5b694c1b98de445ba5c3d67c",
              "version_minor": 0,
              "version_major": 2
            },
            "text/plain": [
              "HBox(children=(FloatProgress(value=1.0, bar_style='info', description='Dl Completed...', max=1.0, style=Progre…"
            ]
          },
          "metadata": {
            "tags": []
          }
        },
        {
          "output_type": "display_data",
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "52dde642a26844dabbc14e7e93adb87f",
              "version_minor": 0,
              "version_major": 2
            },
            "text/plain": [
              "HBox(children=(FloatProgress(value=1.0, bar_style='info', description='Dl Size...', max=1.0, style=ProgressSty…"
            ]
          },
          "metadata": {
            "tags": []
          }
        },
        {
          "output_type": "display_data",
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "b1956b7aeb524552afba21638992f6cd",
              "version_minor": 0,
              "version_major": 2
            },
            "text/plain": [
              "HBox(children=(FloatProgress(value=1.0, bar_style='info', description='Extraction completed...', max=1.0, styl…"
            ]
          },
          "metadata": {
            "tags": []
          }
        },
        {
          "output_type": "stream",
          "text": [
            "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n",
            "  ``ca_cert_dir``, ``ssl_version``, ``key_password`` are only used if :mod:`ssl`\n"
          ],
          "name": "stderr"
        },
        {
          "output_type": "stream",
          "text": [
            "\n",
            "\n",
            "\n",
            "\n",
            "\n",
            "\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "display_data",
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "1825b1eac66c43b780672d6945eaa77a",
              "version_minor": 0,
              "version_major": 2
            },
            "text/plain": [
              "HBox(children=(FloatProgress(value=1.0, bar_style='info', max=1.0), HTML(value='')))"
            ]
          },
          "metadata": {
            "tags": []
          }
        },
        {
          "output_type": "stream",
          "text": [
            "\rShuffling and writing examples to /root/tensorflow_datasets/cifar10/3.0.2.incompleteIYNJKX/cifar10-train.tfrecord\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "display_data",
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "ac2240911b714238a353fa50743675cb",
              "version_minor": 0,
              "version_major": 2
            },
            "text/plain": [
              "HBox(children=(FloatProgress(value=0.0, max=50000.0), HTML(value='')))"
            ]
          },
          "metadata": {
            "tags": []
          }
        },
        {
          "output_type": "stream",
          "text": [
            "\r"
          ],
          "name": "stdout"
        },
        {
          "output_type": "display_data",
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "6124b8c78cd54a839c746ea781389f77",
              "version_minor": 0,
              "version_major": 2
            },
            "text/plain": [
              "HBox(children=(FloatProgress(value=1.0, bar_style='info', max=1.0), HTML(value='')))"
            ]
          },
          "metadata": {
            "tags": []
          }
        },
        {
          "output_type": "stream",
          "text": [
            "\rShuffling and writing examples to /root/tensorflow_datasets/cifar10/3.0.2.incompleteIYNJKX/cifar10-test.tfrecord\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "display_data",
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "bea43d291e0848039e811024bd7e5eea",
              "version_minor": 0,
              "version_major": 2
            },
            "text/plain": [
              "HBox(children=(FloatProgress(value=0.0, max=10000.0), HTML(value='')))"
            ]
          },
          "metadata": {
            "tags": []
          }
        },
        {
          "output_type": "stream",
          "text": [
            "\u001b[1mDataset cifar10 downloaded and prepared to /root/tensorflow_datasets/cifar10/3.0.2. Subsequent calls will reuse this data.\u001b[0m\n",
            "\r"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "pycharm": {
          "name": "#%% Create datasets\n"
        },
        "id": "4jj156Ynto5j",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "datasets = {\n",
        "    key: pd.DataFrame(examples)\n",
        "    .assign(filename=lambda df: str(output_dir / \"cifar10\") + \"/\" + df.id)\n",
        "    .pipe(lambda df: tf.data.Dataset.from_tensor_slices(df.to_dict(\"list\")))\n",
        "    .map(assign(image=read_decode_and_crop_jpeg), num_parallel_calls=tf.data.experimental.AUTOTUNE)\n",
        "    .apply(cache_func)\n",
        "    for key, cache_func in zip(\n",
        "        [\"tf_record_cache\", \"dataset_cache\", \"no_cache\"],\n",
        "        [cache_with_tf_record(output_dir / \"tf_record_cache\"), cache(output_dir / \"dataset_cache\"), lambda ds: ds],\n",
        "    )\n",
        "}\n",
        "datasets.update({\"baseline\": train_dataset})\n",
        "datasets = {\n",
        "    key: dataset.map(\n",
        "        transform(image=partial(tf.image.convert_image_dtype, dtype=tf.float32)),\n",
        "        num_parallel_calls=tf.data.experimental.AUTOTUNE,\n",
        "    )\n",
        "    .map(\n",
        "        lambda x: (\n",
        "            tf.ensure_shape(x[\"image\"], train_dataset.element_spec[\"image\"].shape),\n",
        "            tf.ensure_shape(x[\"label\"], train_dataset.element_spec[\"label\"].shape),\n",
        "        ),\n",
        "        num_parallel_calls=tf.data.experimental.AUTOTUNE,\n",
        "    )\n",
        "    .batch(64)\n",
        "    for key, dataset in datasets.items()\n",
        "}"
      ],
      "execution_count": 10,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "pycharm": {
          "name": "#%% Create model\n"
        },
        "id": "o-QiXSsBto5m",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "model = Sequential(\n",
        "    [\n",
        "        Input(train_dataset.element_spec[\"image\"].shape),\n",
        "        Conv2D(filters=32, kernel_size=(3, 3), padding=\"same\", activation=\"relu\"),\n",
        "        MaxPooling2D(pool_size=2),\n",
        "        Dropout(0.3),\n",
        "        Conv2D(filters=64, kernel_size=(3, 3), padding=\"same\", activation=\"relu\"),\n",
        "        MaxPooling2D(pool_size=2),\n",
        "        Dropout(0.3),\n",
        "        Conv2D(filters=128, kernel_size=(3, 3), padding=\"same\", activation=\"relu\"),\n",
        "        MaxPooling2D(pool_size=2),\n",
        "        Dropout(0.3),\n",
        "        Conv2D(filters=256, kernel_size=(3, 3), padding=\"same\", activation=\"relu\"),\n",
        "        MaxPooling2D(pool_size=2),\n",
        "        Dropout(0.3),\n",
        "        GlobalMaxPooling2D(),\n",
        "        Flatten(),\n",
        "    ]\n",
        ")\n",
        "model.save_weights(str(output_dir / \"initial_weights.h5\"))"
      ],
      "execution_count": 11,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "pycharm": {
          "name": "#%% Train\n"
        },
        "id": "TIdF3n_cto5p",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 301
        },
        "outputId": "f9a0a44d-606c-4e87-b21c-94eaae9d6f07"
      },
      "source": [
        "for key, dataset in datasets.items():\n",
        "    print(f\"Current cache: {key}\")\n",
        "    model.load_weights(str(output_dir / \"initial_weights.h5\"))\n",
        "    model.compile(loss=\"sparse_categorical_crossentropy\", optimizer=\"adam\")\n",
        "    model.fit(dataset.repeat(), steps_per_epoch=5000, callbacks=[TFGpuMonitorCallback(delay=0.5)])"
      ],
      "execution_count": 12,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Current cache: tf_record_cache\n",
            "5000/5000 [==============================] - ETA: 0s - loss: 2.4229\n",
            "[0] Tesla K80        | 49'C,  40 % |   695 / 11441 MB |\n",
            "5000/5000 [==============================] - 109s 22ms/step - loss: 2.4229\n",
            "Current cache: dataset_cache\n",
            "5000/5000 [==============================] - ETA: 0s - loss: 2.4222\n",
            "[0] Tesla K80        | 52'C,  47 % |   695 / 11441 MB |\n",
            "5000/5000 [==============================] - 78s 16ms/step - loss: 2.4222\n",
            "Current cache: no_cache\n",
            "4999/5000 [============================>.] - ETA: 0s - loss: 2.4274\n",
            "[0] Tesla K80        | 43'C,  26 % |   695 / 11441 MB |\n",
            "5000/5000 [==============================] - 164s 33ms/step - loss: 2.4275\n",
            "Current cache: baseline\n",
            "4999/5000 [============================>.] - ETA: 0s - loss: 2.4272\n",
            "[0] Tesla K80        | 44'C,  48 % |   695 / 11441 MB |\n",
            "5000/5000 [==============================] - 77s 15ms/step - loss: 2.4272\n"
          ],
          "name": "stdout"
        }
      ]
    }
  ]
}